 var sys = require('sys')
  var filename = process.ARGV[2];
  var exec = require('child_process').exec;

  if (!filename)
    return sys.puts("Usage: node watcher.js filename");

  // Look at http://nodejs.org/api.html#_child_processes for detail.
  var tail = exec("tail a.txt");
  sys.puts("start tailing");

  tail.addListener("output", function (data) {
    sys.puts(data);
  });

  // From nodejs.org/jsconf.pdf slide 56
  var http = require("http");
  http.createServer(function(req,res){
    res.writeHeader(200,{"Content-Type": "text/plain"});
    tail.addListener("output", function (data) {
      //res.sendBody(data);
     response.end(content, 'utf-8');
    });  
  }).listen(8000);
